package avicit.bdp.dgs.qa.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.bdp.core.constant.Constants;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Map;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2023-09-07
 * @类说明：JobAnalysisDTO
 * @修改记录：
 * @注意事项：
 * @主要功能：质量分析DTO
 */
@ApiModel(value = "AnalysisDTO", description = "质量分析DTO")
@Table(name = "bdp_dgs_qa_analysis")
public class AnalysisDTO extends BaseDTO {
    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 报告名称
     */
    @LogField
    @ApiModelProperty(value = "报告名称")
    @FieldRemark(column = "name", field = "name", name = "报告名称")
    @Column(name = "name")
    private String name;

    /**
     * 选定时间
     */
    @LogField
    @ApiModelProperty(value = "选定时间")
    @FieldRemark(column = "selected_time", field = "selectedTime", name = "选定时间")
    @Column(name = "selected_time")
    private String selectedTime;

    /**
     * 数据范围开始时间
     */
    @Transient
    @JsonFormat(pattern = Constants.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
    private String startTime;

    /**
     * 数据范围结束时间
     */
    @Transient
    @JsonFormat(pattern = Constants.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
    private String endTime;

    /**
     * 质量分析类型，0:日报、1:月报
     */
    @LogField
    @ApiModelProperty(value = "质量分析类型，0:日报、1:月报")
    @FieldRemark(column = "type", field = "type", name = "质量分析类型，0:日报、1:月报")
    @Column(name = "type")
    private Integer type;
    @Transient
    private String typeName;

    /**
     * 质量报告内容,Map<String,Object>格式
     */
    @LogField
    @ApiModelProperty(value = "质量报告内容,Map<String,Object>格式")
    @FieldRemark(column = "report_json", field = "reportJson", name = "质量报告内容,Map<String,Object>格式")
    @Column(name = "report_json")
    private String reportJson;
    @Transient
    private Map<String, Object> reportMap;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSelectedTime() {
        return selectedTime;
    }

    public void setSelectedTime(String selectedTime) {
        this.selectedTime = selectedTime;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getReportJson() {
        return reportJson;
    }

    public void setReportJson(String reportJson) {
        this.reportJson = reportJson;
    }

    public Map<String, Object> getReportMap() {
        return reportMap;
    }

    public void setReportMap(Map<String, Object> reportMap) {
        this.reportMap = reportMap;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "质量日月报模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "质量日月报";
        } else {
            return super.logTitle;
        }
    }
}
